#include<iostream>
#include<vector>
#include<string>
#include"stack.h"



class Solution {
public:
    int evalRPN(vector<string> tokens) {
        my_stack::stack<int> s;
        for (auto& t : tokens)
        {
            if (t == "+" || t == "-" || t == "*" || t == "/")
            {
                int right = s.top();
                s.pop();
                int left = s.top();
                s.pop();

                switch (t[0])
                {
                case '+':
                    s.push(left + right);
                    break;
                case '-':
                    s.push(left - right);
                    break;
                case '*':
                    s.push(left * right);
                    break;
                case '/':
                    s.push(left / right);
                    break;
                }
            }
            else
            {
                s.push(stoi(t));
            }
        }

        return s.top();
    }
};

int main()
{
    cout << Solution().evalRPN({ "4","13","5","/","+" }) << endl;

	return 0;
}